home *** CD-ROM | disk | FTP | other *** search
/ Mesolore / Mesolore - Disc 1.iso / pc / data / Selden Search.dir / 00014_Script_14 < prev    next >
Text File  |  2001-03-05  |  9KB  |  331 lines

  1. Global gList,gLevelNum
  2. global begin,gDataPool,gfirstTime,gShowSearch,gSearchNew,gStartSearchList
  3.  
  4. --on clearrepeats ---!!!
  5. --  temp= the text of member "selden_search_list"
  6. --  hmany = the number of lines in temp
  7. --  repeat with x = 1 to hmany
  8. --    if line x +1 of temp = "#" & (line x of temp) then
  9. --      delete line x+1 of temp
  10. --    end if
  11. --  end repeat
  12. --  put temp
  13. --  
  14. --end
  15. on preparemovie
  16.   sprite(21).visible = false
  17. end
  18.  
  19. on startMovie
  20.   cursor 4
  21.   count = 10
  22.   gSearchNew = TRUE
  23.   gStartSearchList = []
  24.   put "" into field "output"
  25.   repeat while count < 17
  26.     put "" into field the member of sprite (value(count) +1)
  27.     sendSprite((value(count) +1), #beginSprite)
  28.     count = count +1
  29.   end repeat
  30.   --importFileInto member "selden_search_list", "selden_search_list.txt"
  31.   cursor 0
  32. end
  33.  
  34. -----LISTS-----
  35.  
  36. --Called first by clicking on dropdown---
  37.  
  38. on load whList, whSprite
  39.   if whList = "more..." then abort
  40.   set gLevelNum = whSprite - 9
  41.   --createlist
  42.   whList = createList( whList)
  43.   if listP(value(whList)) then
  44.     
  45.     put "more..." & Return into field the member of sprite value(whSprite +1) 
  46.     
  47.     repeat with x in value(whList)
  48.       
  49.       put x & return after field the member of sprite value(whSprite +1)
  50.     end repeat
  51.     
  52.     
  53.     --- init dropDown
  54.     sendSprite(value(whSprite +1), #beginSprite)
  55.     
  56.     --- loads next dropdown from 1st item in list
  57.     hold = line 2 of field the member of sprite value(whSprite +1)
  58.     --put hold
  59.     delete char 1 to 3 of hold
  60.     -- if no more lists abort
  61.     if hold = "" then 
  62.       -- clear out following dropDowns
  63.       count = whSprite 
  64.       repeat while count < 17
  65.         put "" into field the member of sprite (value(count) +1)
  66.         sendSprite((value(count) +1), #beginSprite)
  67.         count = count +1
  68.       end repeat
  69.       abort
  70.     end if
  71.     put "more..." & return into field the member of sprite value(whSprite +2)
  72.     load hold,(whSprite +1)
  73.     sendSprite(value(whSprite +1), #beginSprite)
  74.     
  75.   end if
  76. end
  77.  
  78.  
  79. on createList(whList)
  80.   
  81.   -- keep moving down the datapool so that you don't get bar from an earlier choice!!!!
  82.   if gLevelNum = 1 then
  83.     setDataPool whList
  84.   end if
  85.   temp = gDataPool
  86.   tempList = ""
  87.   begin = FALSE
  88.   
  89.   howMany = the number of lines in temp
  90.   --- add #'s to front of searchword
  91.   repeat with z = 1 to gLevelNum -1
  92.     put "#" before whList
  93.   end repeat
  94.   
  95.   if gLevelNum = 1 then
  96.     z = 1 
  97.   else
  98.     z = getAT (gStartSearchList ,gLevelNum -1)
  99.   end if
  100.   ---find searchword
  101.   repeat with x = z to howmany
  102.     if line x of temp = whList then
  103.       set begin = TRUE
  104.       exit repeat
  105.     end if
  106.   end repeat
  107.   
  108.   
  109.   setAt gStartSearchList, gLevelNum, x
  110.   
  111.   x = x +1
  112.   repeat with x = x to howmany
  113.     holder = line x of temp
  114.     --- stop looping
  115.     if BEGIN = TRUE then
  116.       --- end of section
  117.       if  char (gLevelNum-1) of holder = "#" and not(char gLevelNum of holder = "#") or not(holder contains "#")then 
  118.         --- put line z to x of temp
  119.         exit repeat
  120.       end if
  121.       if char gLevelNum of holder = "#" and  char gLevelNum +1 of holder <> "#"then
  122.         delete char 1 to gLevelNum of holder
  123.         put QUOTE & holder & QUOTE & "," after tempList --- add to list
  124.       end if
  125.     end if
  126.   end repeat
  127.   
  128.   delete the last char of templist
  129.   return value("[" & tempList & "]")
  130. end
  131.  
  132. on setDataPool whList
  133.   temp = the text of member "selden_search_list"
  134.   howMany = the number of lines in temp
  135.   repeat with x = 1 to howmany
  136.     if line x of temp = whList then
  137.       exit repeat
  138.     end if
  139.   end repeat
  140.   holder = line x of temp & RETURN
  141.   repeat with y = (x+1) to howMany
  142.     if line y of temp contains "#" then
  143.       put line y of temp & RETURN after holder
  144.     else
  145.       exit repeat
  146.     end if
  147.   end repeat
  148.   gDataPool = holder
  149.   
  150. end
  151.  
  152.  
  153. -----SEARCHING---------
  154.  
  155. on search(searchList)
  156.   sprite(21).visible = true
  157.   if gSearchNew = TRUE then
  158.     searchNew(searchList)
  159.   else
  160.     searchResults(searchList)
  161.   end if
  162.   sprite(21).visible = false
  163. end
  164.  
  165. on clearMores(searchList)
  166.   repeat with x = the number of items in searchlist down to 1
  167.     if item x of searchlist = "more..." then
  168.       delete item x of searchList
  169.     end if
  170.     
  171.   end repeat
  172.   return searchlist
  173.   
  174. end
  175.  
  176.  
  177.  
  178. on searchNew(searchList)
  179.   put "" into field "output"
  180.   searchlist = clearMores(searchlist)
  181.   put searchlist
  182.   howMany = the number of items in searchList
  183.   
  184.   repeat with x = 1 to the number of members of castLib 3
  185.     repeat with y = 2 to howMany
  186.       if field member x of castLib 3 contains item y of searchList then
  187.         if y = howmany then
  188.           findLine(searchList, x)
  189.         end if
  190.       else
  191.         exit repeat
  192.       end if
  193.     end repeat
  194.   end repeat
  195.   
  196.   if field "output" = "" then
  197.     put "No matches found." into field "output"
  198.   else
  199.     put "Search Complete." after field "output"
  200.     beep
  201.   end if
  202.   set the forecolor of field "output" = 15
  203. end
  204.  
  205. on searchResults(searchList)
  206.   
  207.   howMany = the number of items in searchList
  208.   tempList = []
  209.   repeat with y = 1 to (the number of lines in field "output")-1
  210.     hack = word 1 of line y of field "output"
  211.     if hack <> "" then
  212.       append tempList, hack
  213.     end if
  214.   end repeat
  215.   put "" into field "output"
  216.   put templist
  217.   repeat with x in tempList
  218.     repeat with z = 2 to howMany
  219.       if field member value(x) of castLib 3 contains item y of searchList then
  220.         if z = howmany then
  221.           findLine(searchList, value(x))
  222.         end if
  223.       else
  224.         exit repeat
  225.       end if
  226.     end repeat
  227.   end repeat
  228.   
  229.   if field "output" = "" then
  230.     put "No matches found." into field "output"
  231.   else
  232.     put "Search Complete." after field "output"
  233.     beep
  234.   end if
  235.   set the forecolor of field "output" = 15
  236. end
  237.  
  238. on findLine(searchList,x)
  239.   
  240.   
  241.   howMany = the number of items in searchList
  242.   temp = field member x of castlib 3
  243.   holder = ""
  244.   repeat with z = 2 to howMany
  245.     put item z of searchlist & " " after holder
  246.   end repeat
  247.   delete the last char of holder
  248.   --  put holder
  249.   repeat with y = 1 to the number of lines in temp
  250.     if the mousedown then 
  251.       sprite(21).visible = false
  252.       beep
  253.       abort
  254.     end if
  255.     ---calendar name---
  256.     if searchlist contains"calendarname" then
  257.       if line y of temp contains holder then
  258.         put x && line 1 of temp && "--" && line y of temp & return & return  after field "output"
  259.       end if 
  260.       --- dates ---
  261.     else if searchlist contains"dates" then
  262.       if line y of temp contains holder then
  263.         put x && line 1 of temp && "--" && line y of temp & return & return  after field "output"
  264.       end if   
  265.       ---personal name---
  266.     else if searchlist contains"personalname" then
  267.       testForQuotes = FALSE
  268.       repeat with z = 2 to howMany
  269.         if line y of temp contains item z of searchList then
  270.           if line y of temp contains quote & (item z of searchlist) or line y of temp contains (item z of searchlist) & QUOTE then
  271.             testForQuotes = TRUE
  272.           end if
  273.           if z = howMany and not(line y of temp contains":") and testForQuotes then
  274.             put x && line 1 of temp && "--" && line y of temp & return & return  after field "output"
  275.           end if
  276.         else
  277.           exit repeat 
  278.         end if
  279.       end repeat
  280.       ----new---
  281.     else if searchlist contains"associated" then
  282.       
  283.       repeat with z = 2 to howMany
  284.         if line y of temp contains item z of searchList then
  285.           if z = howMany and line y of temp contains"associated" then
  286.             put x && line 1 of temp && "--" && line y of temp & return & return  after field "output"
  287.           end if
  288.         else
  289.           exit repeat 
  290.         end if
  291.       end repeat
  292.       ----new---
  293.     else
  294.       repeat with z = 2 to howMany
  295.         if line y of temp contains item z of searchList then
  296.           if z = howMany then
  297.             put x && line 1 of temp && "--" && line y of temp & return & return  after field "output"
  298.           end if
  299.         else
  300.           exit repeat 
  301.         end if
  302.       end repeat
  303.     end if
  304.   end repeat
  305.   
  306. end
  307.  
  308.  
  309.  
  310.  
  311.  
  312. on cleanspaces --- from end of items in input list
  313.   temp = the text of member "selden_search_list"
  314.   howmany = the number of lines in temp
  315.   repeat with x = 1 to howmany
  316.     holder = line x of temp
  317.     repeat while the last char of holder = numtochar(32)
  318.       delete the last char of holder
  319.     end repeat
  320.     put holder into line x of temp 
  321.   end repeat
  322.   put temp into the text of member "selden_search_list"
  323. end
  324.  
  325. on closewindow
  326.   gShowSearch = FALSE
  327.   pass
  328. end
  329.  
  330.  
  331.